<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" href="assets/css/bootstrap.min.css">
	<title>xsm工资查询</title>
	<style>
		.seach{
			width: 20%;
		}
		.seaching{
			display: inline-table;
			vertical-align: middle;
			width: 60%;
		}
		.navbar{
			background: #428bca;
			color: #fff;
			text-align: center;
			line-height: 50px;
		}
		.navbar span{
			margin: 0 auto;
			font-size: 2em;
		}
		.navbar a{
			color: #fff;
			float: right;
		}
		.dn{
			display: none;
		}
		.db{
			display: block;
		}
		.fr{float: right;}
	</style>
</head>
<body>
	<div class="navbar">
		<span>工资查询系统</span>
		<a href="/index.php">管理员登录</a>
	</div>

	<div class="input-group seach">
	  <input type="text" class="form-control" placeholder="请输入员工工号" aria-describedby="basic-addon2">
	  <span class="input-group-addon" id="basic-addon2"><i class="glyphicon glyphicon-search"></i></span>
	</div>
	<div>
		<span class="text-danger">薪资计算公式：基本工资÷日工资(21.75)×出勤天数×(日工资÷月工作日)-罚款+奖金</span>
	</div>
	<div class="table-responsive">
		<table class="table table-bordered">
			<thead>
				<tr>
					<th>员工编号</th>
					<th>所在部门</th>
					<th>姓名</th>
					<th>出勤天数</th>
					<th>奖金</th>
					<th>罚款</th>
					<th>月份</th>
					<th>实际工资</th>
				</tr>
			</thead>
			<tbody class="list">
				
			</tbody>
		</table>
	</div>
	<script type="text/javascript" src="assets/js/jquery-1.11.3.min.js"></script>
	<script type="text/javascript" src="assets/layer/layer.js"></script>
	<script type="text/javascript">
		$('#basic-addon2').click(function(){
			var num = $('input[aria-describedby="basic-addon2"]').val();
			if(num != ''){
				$.ajax({
					type:'get',
					url:'php/admin/controller/seach.php',
					data:{id:num},
					success:function(data){
						var date = $.parseJSON(data);
						if(date.status == 0){
							layer.msg(date.msg);
							return;
						}
						$('.list').html('');
						$.each(date.rows,function(i){
							var str = '<tr><td>'+this.user_id+'</td><td>'+this.d_name+'</td><td>'+this.name+'</td><td>'+this.on_day+'</td><td>'+this.add+'</td><td>'+this.fk+'</td><td>'+this.month+'</td><td>'+this.pay+'</td><tr>';
							$('.list').append(str);
						})
						$('select[name="option"]').removeClass('dn').addClass('db');
					},
					error:function(){
						layer.alert('网络链接错误，请稍后再试！',{icon:2});
					}
				})
			}else{
				layer.msg("员工编号不能为空！");
			}
		})
	</script>
</body>
</html>